{{--@extends ('shop-backend::layout')--}}

{{--@section ('title',  '门店标签管理 | 创建门店标签')--}}

{{--@section ('breadcrumbs')--}}
    {{--<h2>创建门店标签</h2>--}}
    {{--<ol class="breadcrumb">--}}
        {{--<li><i class="fa fa-dashboard"></i> 首页</li>--}}
        {{--<li>{!! link_to_route('admin.shop.list.tag', '标签') !!}</li>--}}
        {{--<li class="active">创建门店标签</li>--}}
    {{--</ol>--}}
{{--@stop--}}

{{--@section('content')--}}
    <div class="ibox float-e-margins">
        <div class="ibox-content" style="display: block;">
            {!! Form::open(['route' => 'admin.shop.list.tag.save', 'class' => 'form-horizontal', 'id'=>'create-tag-form', 'role' => 'form', 'method' => 'post', 'files' => true]) !!}

            <div class="form-group">
                <label for="store-tag-name" class="col-md-2 control-label">
                    <span style="color: red">*</span>标签名：
                </label>
                <div class="col-lg-10">
                    {!! Form::text('store-tag-name', isset($tag) && !empty($tag->name) ? $tag->name : null, ['class' => 'form-control', 'placeholder' => '', 'required']) !!}
                </div>
            </div>

            <div class="form-group">
                {!! Form::label('store-tag-url', '标签链接', ['class' => 'col-lg-2 control-label']) !!}
                <div class="col-lg-10">
                    {!! Form::text('store-tag-url', isset($tag->url) && !empty($tag->url) ? $tag->url : null, ['class' => 'form-control', 'placeholder' =>'']) !!}
                </div>
            </div>

            <div class="form-group">
                {!! Form::label('store-tag-img', '标签图片', ['class' => 'col-lg-2 control-label']) !!}
                <div class="col-lg-10">
                    {!! Form::file('store-tag-img', ['class' => 'form-control', 'placeholder' =>'']) !!}
                </div>
            </div>

            <div class="form-group">
                {!! Form::label('store-tag-img', '已上传图片', ['class' => 'col-lg-2 control-label']) !!}
                <div class="col-lg-10">
                    @if(isset($tag) && !empty($tag->file_url))
                        <img src='{!! $tag->file_url !!}'>
                    @endif
                </div>
            </div>

            <div class="form-group">
                {!! Form::label('store-tag-top', '是否3公里优先显示', ['class' => 'col-lg-2 control-label']) !!}
                <div class="col-lg-10">
                    <input type="radio" name="store-tag-top" value="1" @if(isset($tag) && !empty($tag) && $tag->top==1) checked @endif>是
                    <input type="radio" name="store-tag-top" value="0" @if(isset($tag) && !empty($tag) && $tag->top==0) checked @endif>否
                </div>
            </div>

            <div class="form-group">
                {!! Form::label('store-tag-point_img', '是否使用标签图片做定位点图片', ['class' => 'col-lg-2 control-label']) !!}
                <div class="col-lg-10">
                    <input type="radio" name="store-tag-point_img" value="1" @if(isset($tag) && !empty($tag) && $tag->point_img==1) checked @endif>是
                    <input type="radio" name="store-tag-point_img" value="0" @if(isset($tag) && !empty($tag) && $tag->point_img==0) checked @endif>否
                </div>
            </div><!--form control-->

            <div class="form-group">
                <div class="col-lg-10">
                    {!! Form::hidden('store-tag-id', isset($tag) && !empty($tag->id) ? $tag->id : null) !!}
                </div>
            </div><!--form control-->

            <div class="well">
                <div class="pull-right">
                    <input type="submit" class="btn btn-success btn-xs" value="保存" />
                </div>
                <div class="clearfix"></div>
            </div><!--well-->

            {!! Form::close() !!}
        </div>
    </div>
{{--@stop--}}

{{--@section('after-scripts-end')--}}
    <script>
        $(function () {
            // save return
            $('#create-tag-form').ajaxForm({
                success: function (result) {
                    if (200 == result.code) {
                        swal({
                            title: "保存成功！",
                            text: "",
                            type: "success"
                        }, function () {
                            window.location = '{{route('admin.shop.list.tag')}}';
                        });
                    } else {
                        swal("保存失败!", result.message, "error")
                    }

                }
            });
        });
    </script>
{{--@stop--}}